package com.itheima01;

import java.util.LinkedList;


public class NBLinked extends LinkedList {
    public Object updateFirst(Object newTou) {
        Object oldTou = super.getFirst();
        super.removeFirst();
        super.addFirst(newTou);
        return oldTou;

    }

    public Object updateLast(Object newWei) {
        Object oldWei = super.getLast();
        super.removeFirst();
        super.addFirst(newWei);
        return oldWei;

    }


}
